package io.renren.modules.project.controller;

import java.util.Arrays;
import java.util.Map;
import java.util.List;

import io.renren.modules.project.entity.QulaityMarkEntity;
import io.renren.modules.project.service.QulaityMarkService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 质量评分表
 *
 * @author ygg
 * @date 2022-03-29 16:48:48
 */
@RestController
@RequestMapping("project/qulaitymark")
public class QulaityMarkController {
    @Autowired
    private QulaityMarkService qulaityMarkService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        List<QulaityMarkEntity> list = qulaityMarkService.queryList(params);
        List<QulaityMarkEntity> group = qulaityMarkService.groupList(params);

        return R.ok().put("list", list).put("group",group);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        QulaityMarkEntity qulaityMark = qulaityMarkService.selectById(id);

        return R.ok().put("qulaityMark", qulaityMark);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody QulaityMarkEntity qulaityMark){
        qulaityMarkService.save(qulaityMark);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody QulaityMarkEntity qulaityMark){
        qulaityMarkService.updateById(qulaityMark);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        qulaityMarkService.deleteBatch(ids);

        return R.ok();
    }

}
